package com.example.composedemo.api

import android.util.Log
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.lib_network.core.HttpResult
import com.example.lib_network.utils.MoshiUtils
import kotlinx.coroutines.launch

/**
 * @author shuguo
 * @date :2024/5/3 17:17
 * @description:
 */
class WaModel: ViewModel() {

    fun banner(){
        viewModelScope.launch {
            val result = WanAndroidApiService.getService().getBanner()
            when (result) {
                is HttpResult.Success -> {
                    Log.e("Success", MoshiUtils.toJson(result.data))
                }

                is HttpResult.Failure -> {
                    Log.e("Failure", result.message + "  -----  " + result.code)
                }

            }
        }
    }

}